HTMLify

upload certificate.html
Views: 154 | Author: sachinthakur
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Upload Certificate || TIS</title>
    
</head>
<body>
 <header>
        <nav>
          <div class="navbar">
            <ul class="nav-links">
              <li><a href="#">Home</a></li>
              <li><a href="#">About</a></li>
              <li><a href="#">Contact</a></li>
            </ul>
          </div>
        </nav>
      </header>
    
    <div class="container">
        <h2>Upload Certificate</h2>
        <form id="uploadForm" enctype="multipart/form-data">
            <label for="name">Student Name:</label>
            <input type="text" id="name" name="name" required>
            <span id="nameError" class="error"></span>

            <label for="roll_number">Roll Number:</label>
            <input type="text" id="roll_number" name="roll_number" required>
            <span id="rollNumberError" class="error"></span>

            <label for="file">Select Certificate (PDF only):</label>
            <input type="file" id="file" name="file" accept=".pdf" required>
            <span id="fileError" class="error"></span>

             <button type="submit">Upload Certificate</button>
        </form>
    </div>

   
</body>
</html>


<style>
 body {
        font-family: Arial, sans-serif;
        margin: 0;
        padding: 0;
        background-image: url('https://png.pngtree.com/thumb_back/fh260/background/20210903/pngtree-technology-cloud-upload-image_782019.jpg');
    }

    header {
    background-color: #007bff;
    color: #fff;
    padding: 10px 0;
  }

    .container {
        max-width: 500px;
        margin: 50px auto;
        padding: 20px;
        background-color:rgb(127,255,212);
        border-radius: 8px;
        box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    }
  
    h2{
       color: black;
         
        }
 
    label {
        display: block;
        margin-bottom: 5px;
        color: black;

    }

    input[type="text"],
    input[type="file"] {
        width: 100%;
        padding: 10px;
        margin-bottom: 20px;
        border: 1px solid #ccc;
        border-radius: 5px;
        box-sizing: border-box;
    }

    button {
    background-color: #007bff;
    color: #fff;
    padding: 10px 20px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
  }
  
  button:hover {
    background-color: #0056b3;
  }
  

    .error {
        color: red;
        font-size: 14px;
        margin-top: -5px;
    }

    .navbar {
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;

    
  }

  .navbar a:hover{
    background-color: red;
  }
  
  .nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
  }
  
  .nav-links li {
    display: inline;
    margin-right: 20px;
  }
  
  .nav-links li:last-child {
    margin-right: 0;
  }
  
  .nav-links a {
    color: #fff;
    text-decoration: none;
  }
  
</style>


<script>
    document.getElementById('uploadForm').addEventListener('submit', function(event) {
        var name = document.getElementById('name').value.trim();
        var rollNumber = document.getElementById('roll_number').value.trim();
        var file = document.getElementById('file').value.trim();

        var nameError = document.getElementById('nameError');
        var rollNumberError = document.getElementById('rollNumberError');
        var fileError = document.getElementById('fileError');

        nameError.textContent = '';
        rollNumberError.textContent = '';
        fileError.textContent = '';

        if (name === '') {
            nameError.textContent = 'Please enter student name';
            event.preventDefault();
        }

        if (rollNumber === '') {
            rollNumberError.textContent = 'Please enter roll number';
            event.preventDefault();
        }

        if (file === '') {
            fileError.textContent = 'Please select a file';
            event.preventDefault();
        }
    });
</script>

Comments